a416cebfc67044761ff294331f38fafbba0986c5,load-test-framework/src/main/java/com/google/pubsub/clients/gcloud/CPSPublisherTask.java,CPSPublisherTask,CPSPublisherTask,#StartRequest#,51
Before Change
private CPSPublisherTask(StartRequest request) {
super(request, "gcloud", MetricsHandler.MetricName.PUBLISH_ACK_LATENCY);
this.pubSub = PubSubOptions.builder()
.projectId(request.getProject())
.build().service();
this.topic = Preconditions.checkNotNull(request.getTopic());
this.payload = LoadTestRunner.createMessage(request.getMessageSize());
this.batchSize = request.getPublishBatchSize();
this.id = (new Random()).nextInt();
After Change
super(request, "gcloud", MetricsHandler.MetricName.PUBLISH_ACK_LATENCY);
try {
this.publisher =
Publisher.newBuilder(TopicName.create(request.getProject(), request.getTopic()))
.setBundlingSettings(
BundlingSettings.newBuilder()
.setDelayThreshold(
Duration.millis(Durations.toMillis(request.getPublishBatchDuration())))
.setRequestByteThreshold(9500000L)
.setElementCountThreshold(950L)
.build())
.setFlowControlSettings(
FlowControlSettings.newBuilder()
.setMaxOutstandingRequestBytes(1000000000)
.build()) // 1 GB
.build();
} catch (Exception e) {
throw new RuntimeException(e);
}